Fix logout from Wazuh when SAML is enabled (4.4) #4664
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When SAML is enabled, the logout button inside the Wazuh plugin didn't work properly. That was because there is a function to remove the token before redirecting to logout, and the logout URL is different when SAML is enabled.
The solucion provided is to get the logout URL programatically from the logout anchor. That way, the issue is resolved and there is no need to modify anything in case that the logout URL changes in the future.
Issues Resolved
#4595
Evidence
Trying to logout from the Wazuh plugin before the changes:
Trying to logout from the Wazuh plugin after the changes (the user is correctly redirected to the idp login page):
Test
Scenario: have an environment with xPack
When the user opens the Wazuh plugin and clicks on log out
Then the session should be closed and the user redirected to the login page
Scenario: have an environment with OpenDistro
When the user opens the Wazuh plugin and clicks on log out
Then the session should be closed and the user redirected to the login page
Scenario: have an environment with OpenSearch
When the user opens the Wazuh plugin and clicks on log out
Then the session should be closed and the user redirected to the login page
Scenario: have an environment with SAML
When the user opens the Wazuh plugin and clicks on log out
Then the session should be closed and the user redirected to the login page
Check List
yarn test:jest